/*----------------------------------------------------------------------------
* This unit test tests the function supplyCount(). 
*----------------------------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 0

int main() {

	int i, expectCount, actualCount;
    struct gameState G, preG;
	int seed = rand() % 11;
	SelectStream(1);
	PutSeed((long)seed);
	
	//loop through all possible cards and give them a random count
	for(i = 0; i <= treasure_map; i++) {  
	
		G = preG;
		expectCount = (int)floor(Random() * 46);
		G.supplyCount[i] = expectCount; //largest possible number of card is copper cards: 60 - (7 * min number of players which is 2). 
		actualCount = supplyCount(i, &G);
		if(expectCount == actualCount) {
#if (NOISY_TEST == 1)
			printf("supplyCount(): PASS when random counts assigned to card %d. \n", i);
			printf("\t Details: actualCount = %d, expectCount = %d. \n", actualCount, expectCount);
#endif				
		}
		else
		{
			printf("supplyCount(): FAIL when random counts assigned to card %d. \n", i);			
#if (NOISY_TEST == 1)
			printf("\t Details: actualCount = %d, expectCount = %d. \n", actualCount, expectCount);
#endif	
		}
	}

	printf("supplyCount(): PASS. \n");			
	
	return 0;
}